<h4 ><{t}>高级设置：<{/t}></h4>
<div class="division">
  <table width="100%" cellspacing="0" cellpadding="2" border="0">
    <tr>
      <th><{t}>是否开启 评分：<{/t}></th>
      <td><input type='radio' name="comment_point_status"  <{if $status=='on'}>checked="checked"<{/if}>value="on" class="status"><{t}>是<{/t}>
        <input type='radio' name="comment_point_status"  <{if $status=='off'}>checked="checked"<{/if}> value="off" class="status"><{t}>否<{/t}></td>
    </tr>
    <tr <{if $status=='off'}> style="display:none"<{/if}>>
      <th><{t}>评分项目：<{/t}></th>
      <td>
        <ul>
          <{foreach from=$point_type item=point_type}>
          <li>
            <{input type='text' name="point_type_name[{$point_type.type_id}][name]" vtype="required" value="{$point_type.name}"  /}>
            <span><input type=radio name="total_point" <{if $point_type.addon.is_total_point == 'on'}>checked="checked"<{/if}> value="<{$point_type.type_id}>"/></span>
            <{if $point_type.type_id!=1}>
            <span class='delete_point_type'><{t}><{img src="bundle/delete.gif" class="del-tag lnk"}><{/t}></span>
            <{else}>
            <span><{t}>勾选代表作为商品总分<{/t}></span>
            <{/if}>
          </li>
          <{/foreach}>
          <li id="new_point_type" style="display:none" ><input type="text" class="x-input" vtype="required" />
            <span><input type=radio name="total_point"/></span>
            <span class='delete_point_type'><{t}><{img src="bundle/delete.gif" class="del-tag lnk"}><{/t}></span>
          </li>
        </ul>

      </td>
    </tr>
    <tr><th></th>
      <td><!-- <input type="button" value="添加" id='add_point_type'/> -->
        <{if $status=='off'}>
        <{button style="display:none;" label="添加" value="添加" id='add_point_type'}>
        <{else}>
        <{button  label="添加" value="添加" id='add_point_type'}>
        <{/if}>
      </td>
    </tr>
    <{if $point_status != '1'}>
    <tr>
      <th><{t}>评论审核后可获得积分：<{/t}></th>
      <td><input type='text' name="member_point" vtype='required' value='<{$member_point}>'/></td>
    </tr>
    <{/if}>
  </table>
</div>
<script>
  (function(){
    $('add_point_type').addEvent('click',function(item){
      var addTr = $('new_point_type').clone();
      var timestamp = $time();
      addTr.setStyle('display','');
      addTr.getElement('input').name="point_type_name["+timestamp+"][name]";
      addTr.getElement('input[name=total_point]').value=timestamp;
      var broTable = this.getParent('table').getElements('li').getLast().getPrevious();
      addTr.inject(broTable,'after');
    });


    // $('add_point_type').addEvent('click',function(item){
    //          var lastLi = this.getParent('tr').getPrevious('tr').getElements('li').getLast();
    //          var lastUl_li = this.getParent('tr').getPrevious('tr').getElements('ul').getLast().getElements('li').getLast();
    //          var _input_value = lastUl_li.getElements('input').getLast().value.toInt();
    //          var lastInput = lastLi.getElements('input').getLast();
    //          lastInput.value = $time();
    //          var newLi = lastLi.clone();
    //          newLi.setStyle('display','');
    //          newLi.inject(lastUl_li,'after');
    //     $$('.insert').getLast().value = '';
    //     $$('.delete_point_type').addEvent('click',function(){
    //         this.getParent('li').remove();
    //     });
    //     //lastLi.remove();

    // });

    $$('.status').addEvent('click',function(){
      if(this.value=='on'){
        this.getParent('tr').getNext('tr').show();
        $('add_point_type').show();
      }
      if(this.value=='off'){
        this.getParent('tr').getNext('tr').hide();
        $('add_point_type').hide();
      }
    });

    $('comment_setting').addEvent('click',function (e) {
      e = $(e.target);
      if(e.hasClass('del-tag')){
        e.getParent('li').destroy();
      }
    });

  })();
</script>
